package com.zmzncs.lmtc.module.promotion.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zmzncs.lmtc.common.util.ExceptionUtil;
import com.zmzncs.lmtc.module.promotion.dao.ReserveFeeScaleDao;
import com.zmzncs.lmtc.module.promotion.dao.ReserveRuleDao;
import com.zmzncs.lmtc.module.promotion.dao.ReserveTemporaryRuleDao;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_fee_scale.ReserveFeeScale;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_fee_scale.ReserveFeeScaleDTO;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_rule.ReserveRuleDTO;
import com.zmzncs.lmtc.module.promotion.service.ReserveFeeScaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 促销-预约规则的时段预约费 服务实现类
 * </p>
 *
 * @author 高博文
 * @since 2020-12-14
 */
@Service
public class ReserveFeeScaleServiceImpl extends ServiceImpl<ReserveFeeScaleDao, ReserveFeeScale> implements ReserveFeeScaleService {

    @Autowired
    ReserveFeeScaleDao reserveFeeScaleDao;
    @Autowired
    ReserveRuleDao reserveRuleDao;



    /**
     * 根据停车场id查询收费标准
     */
    @Override
    public List<ReserveFeeScaleDTO> getByParkId(Long parkId) {
        ReserveRuleDTO ruleDTO = reserveRuleDao.getByParkId(parkId);

        // reserveTemporaryRuleDao.get
        if(ruleDTO == null){
            ExceptionUtil.businessException("停车场暂无开放预约功能");
        }
        return reserveFeeScaleDao.getByParkId(parkId);
    }

}
